package com.leinao.constant;

/**
 * 常量表
 * @author  wangshoufa 
 * @date 2018年11月12日 上午11:07:29
 *
 */
public class Constant {

	// JWT生成需要的信息（私钥、签发者、主题、观众、过期时间、更新token时间差）
	public static final String APP_KEY = "bitahub";
	public static final String ISSUER = "bitahub.com";
	public static final String SUBJECT = "彼塔社区";
	public static final String AUDIENCE = "admin";
	public static final Long EXPIREDMILLIS = 7200000L;// 2小时
	public static final Long UPDATEMILLIS = 600000L;// 10分钟

	// 默认页数
	public final static Integer DEFAULT_PAGE_NUMBER = 1;
	// 默认每页显示条数
	public final static Integer DEFAULT_PAGE_SIZE = 10;

	/**
	 * 用户session信息KEY
	 */
	public final static String USER_SESSION_KEY = "userInfo";

	/**
	 * 用户sToken
	 */
	public final static String USER_TOKEN = "token";
	public final static String USER_BITA_TOKEN = "bitaToken";

	/**
	 * 文件中心访问接口地址
	 */
	/**
	 *  项目创建仓库初始化
	 */
	public final static String FILE_CENTER_PROJECT_INIT_REPOSITORY_API = "/file/project/initRepository";
	/**
	 * 克隆项目仓库代码
	 */
	public final static String FILE_CENTER_PROJECT_CLONE_REPOSITORY_API = "/file/project/cloneRepository";
	/**
	 *  任务创建标签初始化
	 */
	public final static String FILE_CENTER_JOB_INIT_TAG_API = "/file/job/initTag";

	/**
	 * 社区用户信息获取
	 */
	public final static String BITAHUB_USER_INFO_GET_API = "/manage/getUserInfoByUserIdOrEmail";

	/**
	 * rest-server访问接口地址
	 */
	// 登录获取token
	public final static String REST_SERVER_LOGIN_API = "/api/v1/token";
	// 提交任务
	public final static String REST_SERVER_SUBMIT_JOB_API = "/api/v1/jobs/";
	// 获取任务信息
	public final static String REST_SERVER_LOAD_JOB_API = "/api/v1/jobs/";
	// 任务操作
	public final static String REST_SERVER_STOP_JOB_API = "/api/v1/jobs/jobName/executionType";
	// 批量查询任务信息
	public final static String REST_SERVER_BATCH_QUERY_JOB_API = "/api/v1/jobs/batchJob/";

	/**
	 * 一级分类
	 */
	public final static Long CATEGORY_TREE_TOP_ID = 0L;

	/**
	 * 文件路径分隔符
	 */
	public final static String FILE_PATH_SEPARATOR = "/";

	/**
	 * 项目配置中的属性
	 */
	public final static String CONFIG_JOB_NAME = "jobName";
	public final static String CONFIG_OUTPUT = "output";
	public final static String CONFIG_CODE_DIR = "codeDir";
	public final static String OUTPUT_SUB_OUTPUTS = "outputs";
	public final static String PROJECT_CODE = "code";

	/**
	 * 项目目录结构化
	 */
	public final static String PROJECT_CODE_STRUCTURE = "/code";
	public final static String TASK_OUTPUTS_STRUCTURE = "/outputs";

	/**
	 * 200  访问成功
	 * 202  已经接受请求，但未处理完成
	 * 500  服务器出错
	 * 404  链接无效
	 * 400  客户端请求的语法错误，服务器无法理解
	 * 401  请求要求用户的身份认证
	 * 409  服务器完成客户端的PUT请求是可能返回此代码，服务器处理请求时发生了冲突
	 */
	public final static int RESPONSE_STATUS_SUCCESS = 200;
	public final static int RESPONSE_STATUS_ACCEPTED = 202;
	public final static int RESPONSE_STATUS_SERVER_ERROR = 500;
	public final static int RESPONSE_STATUS_INVALID_LINK = 404;
	public final static int RESPONSE_STATUS_BAD_REQUEST_ERROR = 400;
	public final static int RESPONSE_STATUS_UNAUTHORIZED_ERROR = 401;
	public final static int RESPONSE_STATUS_CONFLICT_ERROR = 409;

	/**
	 * 调用计算平台1.0登录返回码
	 * 0 成功 10003 用户不存在  4 密码错误
	 */
	public final static int LOGIN_RESULT_SUCCESS = 0;
	public final static int LOGIN_RESULT_USER_NOT_EXIST = 10003;
    public final static int LOGIN_RESULT_PASSWORD_ERROR = 4;

    /**
     * 算力使用情况对比 默认天数
     */
	public final static int CALCULATION_DATE_COUNT = 7;

	/**
	  * 团队简介字数限制
	  */
	public final static int TEAM_INTRODUCTION_LENGTH = 100;
	/**
	  * 团队通知字数限制
	  */
	public final static int TEAM_NOTICE_LENGTH = 200;

    /**
     * 任务备注最大长度500
     */
    public final static int JOB_REMART_MAX_LENGTH = 500;

	/**
	  * 任务的状态:任务不存在
	  */
	public final static String  JOB_STATUS_NOT_FOUND= "JOB_NOT_FOUND";
	/**
	 * 任务的状态:等待
	 */
	public final static String JOB_STATUS_WAITING ="WAITING";
	/**
	 * 任务的状态:运行时
	 */
	public final static String JOB_STATUS_RUNNING ="RUNNING";
	/**
	 * 任务的状态:成功
	 */
	public final static String JOB_STATUS_SUCCEEDED ="SUCCEEDED";
	/**
	 * 任务的状态:失败
	 */
	public final static String JOB_STATUS_FAILED ="FAILED";
	/**
	 * 任务的状态:停止
	 */
	public final static String JOB_STATUS_STOPPED ="STOPPED";

	/**
	 * 任务标签长度16
	 */
    public final static int JOBTAG_LENGTH =16;

	// 数据集路径信息
    public final static String DATASET_PATH = "/datasets";
	public final static String DATASET__CONTAINER_PATH = "/data";

	// 模型路径信息
	public final static String MODELS_PATH = "/models";
	public final static String MODELS_CONTAINER_PATH = "/model";

    /**
      * 关注标记
      */
	public final static int MODEL_NO_ATTENTION = 0;
	public final static int MODEL_IS_ATTENTION = 1;

	/**
	 * 修改行数
	 */
	public final static int UPDATE_COUNT = 1;
	public final static int REPLACE_COUNT = 2;

	/**
	 * Long类型非空校验常量
	 */
	public final static Long DATASET_LONG_TYPE_EMPTY = 0L;

    /**
     * tensorboard用
     */
    public final static String TENSORBOARD_SERVER_DOMAIN = "http://10.11.3.5:50000/jobs";
    //public final static String USER_CENTER_SYSTEM = "http://127.0.0.1:10001/tensorboard/reloadNginx";
    //public final static String USER_CENTER_SYSTEM = "http://112.31.12.175:58180/leinao-usercenter-controller/tensorboard/reloadNginx";
    public final static String USER_CENTER_SYSTEM = "http://service.usercenter.bitahub.com/tensorboard/reloadNginx";
    public final static String TENSORFLOW_DOMAIN = ".tensorboard.bitahub.com";

	/**
	 * redis中存储的用户运行中任务消耗算力数
	 */
	public static final String USER_RUNNING_JOB ="user_running_job";
}

